package com.wyzy.spring;

import com.wyzy.spring.object.Person;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/hello")
public class Hello {
    @RequestMapping("/")
    public String t0(){
        return "hello t0";
    }
    @RequestMapping(value = "/t1",method = RequestMethod.GET)
    public String t1(){
        return "hello t1";
    }
    @RequestMapping(value = "/t1",method = RequestMethod.POST)
    public String t2(){
        return "hello t2";
    }
    @GetMapping("/t3")
    public String t3(){
        return "hello t3";
    }
    @PostMapping("/t3")
    public String t4(){
        return "hello t4";
    }
    @RequestMapping(value = "/t5",method = {RequestMethod.GET,RequestMethod.POST})
    public String t5(){
        return "hello t5";
    }
    @RequestMapping("/t6")
    public String t6(String name,Integer age){
        return "接收参数：" + name + "年龄：" + age;
    }
    @RequestMapping("/t7")
    public String t7(Person person){
        return "接收参数：" + person;
    }
    @RequestMapping("/t8")
    public String t8(@RequestParam("as") String name){
        return "接收参数：" + name;
    }
    @RequestMapping("/t9")
    public String t9(String[] names){
        return "接收参数：" + Arrays.toString(names);
    }
    @RequestMapping("/t10")
    public String t10(@RequestParam List<String> names){
        return "接收参数：" + names;
    }
}
